package com.qf.cqut.Service.impl;

import com.qf.cqut.Service.NoticeService;
import com.qf.cqut.mapper.ANoticeMapper;
import com.qf.cqut.model.pojo.ANotice;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NoticeServiceImpl implements NoticeService {

    @Resource
    private ANoticeMapper aNoticeMapper;

    @Override
    public List<ANotice> selectByLimit(Integer page, Integer limit) {
        if(page != null && limit != null){
            page = (page - 1) * limit;
        }else{
            page = 0;
            limit = 10;
        }
        return aNoticeMapper.selectByLimit(page,limit);
    }

    @Override
    public Integer count() {
        return aNoticeMapper.count();
    }

    @Override
    public List<ANotice> queryByConditions(ANotice aNotice) {
        return aNoticeMapper.queryByConditions(aNotice);
    }

    @Override
    public Integer delByIds(String[] ids) {
        return aNoticeMapper.deleteByIds(ids);
    }

    @Override
    public Integer addAnotice(ANotice aNotice) {
        return aNoticeMapper.addAnotice(aNotice);
    }

    @Override
    public Integer editAnotice(ANotice aNotice) {
        return aNoticeMapper.editAnotice(aNotice);
    }
}
